package com.gps.skyrc.tool;

import android.app.Dialog;
import android.content.Context;
import android.support.annotation.NonNull;
import android.view.KeyEvent;

import com.gps.skyrc.R;


public class CustomProgressDialog extends Dialog {

    public CustomProgressDialog(Context context) {
        this(context,true, R.style.CustomProgressDialog);
    }

    public CustomProgressDialog(Context context, boolean flag, int theme) {
        super(context, theme);
        this.setContentView(R.layout.activity_loading);
        setCanceledOnTouchOutside(false);
        this.setCancelable(flag);
        //this.getWindow().getAttributes().gravity = Gravity.CENTER;
        // TextView tvMsg = (TextView) this.findViewById(R.id.id_tv_loading_msg);
        //if (tvMsg != null) {
        //tvMsg.setText(strMessage);
        //}
    }

    @Override
    public boolean onKeyDown(int keyCode, @NonNull KeyEvent event) {
        if (keyCode == KeyEvent.KEYCODE_BACK)
            return true;
        return super.onKeyDown(keyCode, event);
    }
}
